﻿#ifndef  THREADTASK_H
#define  THREADTASK_H

#include <QObject>
#include "API_BaseWidget.h"

namespace BaseWidget
{
    class ProcessBar;

    class API_BASEWIDGET ThreadTask : public QObject
    {
        Q_OBJECT

    public:
        ThreadTask();
        ~ThreadTask();

        void startThread();

    signals:
        void signal_startThread();
        void signal_closeThread();

        // 任务完成
        void signal_threadFinished();
        // 线程休眠指定毫秒
        void signal_sleepThread(int msec);

    public slots:
        virtual void run() = 0;
        void stop();

    protected:
        void threadTaskFinished();

    protected:
        ProcessBar* m_process;
        bool m_isThreadRuning{ false };
    };
}
#endif // THREADTASK_H
